-
Notifications
You must be signed in to change notification settings - Fork 233
feat: added support for MRRT on Android/iOS #1258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
8966a87
e02ca6b
ce2a7c6
20ea213
6aa0180
a1458c3
a5fb232
dc10e43
d1bcb71
10a4e3b
e8182e5
920bf99
7909449
f0546d0
7f0cce0
e5a574d
ac59591
58ce08c
1edb925
b44cec8
6cb2524
68cd580
1f994d2
d4b153b
8bc36ac
4afe3ab
860205b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,70 +1,70 @@ | ||
| name: PUBLISH DOCS | ||
| on: | ||
| workflow_dispatch: | ||
| workflow_call: | ||
| # or set up your own custom triggers | ||
| workflow_dispatch: | ||
| workflow_call: | ||
| # or set up your own custom triggers | ||
| permissions: | ||
| contents: write # allows the 'Commit' step without tokens | ||
| contents: write # allows the 'Commit' step without tokens | ||
|
|
||
| jobs: | ||
| get_history: # create an artifact from the existing documentation builds | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: get the gh-pages repo | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: gh-pages | ||
| get_history: # create an artifact from the existing documentation builds | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: get the gh-pages repo | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: gh-pages | ||
|
|
||
| - name: remove all symbolic links from root if present | ||
| run: | | ||
| find . -maxdepth 1 -type l -delete | ||
| - name: remove all symbolic links from root if present | ||
| run: | | ||
| find . -maxdepth 1 -type l -delete | ||
|
|
||
| - name: tar the existing docs from root | ||
| run: | | ||
| tar -cvf documentation.tar ./ | ||
| - name: tar the existing docs from root | ||
| run: | | ||
| tar -cvf documentation.tar ./ | ||
|
|
||
| - name: create a document artifact | ||
| uses: actions/upload-artifact@v5 | ||
| with: | ||
| name: documentation | ||
| path: documentation.tar | ||
| retention-days: 1 | ||
| - name: create a document artifact | ||
| uses: actions/upload-artifact@v5 | ||
| with: | ||
| name: documentation | ||
| path: documentation.tar | ||
| retention-days: 1 | ||
|
|
||
| build_and_deploy: # builds the distribution and then the documentation | ||
| needs: get_history | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout src | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| token: ${{ github.token }} | ||
| build_and_deploy: # builds the distribution and then the documentation | ||
| needs: get_history | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout src | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| token: ${{ github.token }} | ||
|
|
||
| - name: Download the existing documents artifact | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| name: documentation | ||
| - run: rm -rf ./docs # delete previous docs folder present | ||
| - run: mkdir ./docs # create an empty docs folder | ||
| - run: tar -xf documentation.tar -C ./docs | ||
| - run: rm -f documentation.tar | ||
| - name: Download the existing documents artifact | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| name: documentation | ||
| - run: rm -rf ./docs # delete previous docs folder present | ||
| - run: mkdir ./docs # create an empty docs folder | ||
| - run: tar -xf documentation.tar -C ./docs | ||
| - run: rm -f documentation.tar | ||
|
|
||
| - name: Setup | ||
| uses: ./.github/actions/setup | ||
| - name: Setup | ||
| uses: ./.github/actions/setup | ||
|
|
||
| - name: Build documents | ||
| run: yarn docs #set up 'docs' build script in your package.json | ||
| - name: Build documents | ||
| run: yarn docs #set up 'docs' build script in your package.json | ||
|
|
||
| - name: Remove all the symbolic links from docs folder | ||
| run: find ./docs -type l -delete | ||
| - name: Remove all the symbolic links from docs folder | ||
| run: find ./docs -type l -delete | ||
|
|
||
| - name: Run cleanup and manage document versions | ||
| run: node scripts/manage-doc-versions.js | ||
| - name: Run cleanup and manage document versions | ||
| run: node scripts/manage-doc-versions.js | ||
|
|
||
| - name: Deploy to GitHub Pages | ||
| uses: peaceiris/actions-gh-pages@v4 | ||
| with: | ||
| github_token: ${{ github.token }} | ||
| publish_dir: ./docs | ||
| keep_files: false | ||
| - name: Deploy to GitHub Pages | ||
| uses: peaceiris/actions-gh-pages@v4 | ||
| with: | ||
| github_token: ${{ github.token }} | ||
| publish_dir: ./docs | ||
| keep_files: false |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ import android.app.Activity | |||||||||||
| import android.content.Intent | ||||||||||||
| import androidx.fragment.app.FragmentActivity | ||||||||||||
| import com.auth0.android.Auth0 | ||||||||||||
| import com.auth0.android.result.APICredentials | ||||||||||||
| import com.auth0.android.authentication.AuthenticationAPIClient | ||||||||||||
| import com.auth0.android.authentication.AuthenticationException | ||||||||||||
| import com.auth0.android.authentication.storage.CredentialsManagerException | ||||||||||||
|
|
@@ -290,6 +291,46 @@ class A0Auth0Module(private val reactContext: ReactApplicationContext) : A0Auth0 | |||||||||||
| promise.resolve(secureCredentialsManager.hasValidCredentials(minTtl.toLong())) | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| @ReactMethod | ||||||||||||
| override fun getApiCredentials( | ||||||||||||
| audience: String, | ||||||||||||
| scope: String?, | ||||||||||||
| minTtl: Double, | ||||||||||||
| parameters: ReadableMap, | ||||||||||||
| promise: Promise | ||||||||||||
| ) { | ||||||||||||
| val cleanedParameters = mutableMapOf<String, String>() | ||||||||||||
| parameters.toHashMap().forEach { (key, value) -> | ||||||||||||
| value?.let { cleanedParameters[key] = it.toString() } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| UiThreadUtil.runOnUiThread { | ||||||||||||
| secureCredentialsManager.getApiCredentials( | ||||||||||||
| audience, | ||||||||||||
| scope, | ||||||||||||
| minTtl.toInt(), | ||||||||||||
| cleanedParameters, | ||||||||||||
| emptyMap(), // headers not supported from JS yet | ||||||||||||
| object : com.auth0.android.callback.Callback<APICredentials, CredentialsManagerException> { | ||||||||||||
| override fun onSuccess(credentials: APICredentials) { | ||||||||||||
| val map = ApiCredentialsParser.toMap(credentials) | ||||||||||||
| promise.resolve(map) | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| override fun onFailure(e: CredentialsManagerException) { | ||||||||||||
| val errorCode = deduceErrorCode(e) | ||||||||||||
| promise.reject(errorCode, e.message, e) | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| @ReactMethod | ||||||||||||
| override fun clearApiCredentials(audience: String, promise: Promise) { | ||||||||||||
| secureCredentialsManager.clearApiCredentials(audience) | ||||||||||||
| promise.resolve(true) | ||||||||||||
| } | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing blank line before closing brace For consistency with the rest of the class structure, there should be a blank line before the closing method brace and the next method/property.
Suggested change
|
||||||||||||
| override fun getConstants(): Map<String, String> { | ||||||||||||
| return mapOf("bundleIdentifier" to reactContext.applicationInfo.packageName) | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||||
| package com.auth0.react | ||||||||
|
|
||||||||
| import com.auth0.android.result.APICredentials | ||||||||
| import com.facebook.react.bridge.Arguments | ||||||||
| import com.facebook.react.bridge.ReadableMap | ||||||||
|
|
||||||||
| object ApiCredentialsParser { | ||||||||
|
|
||||||||
| private const val ACCESS_TOKEN_KEY = "accessToken" | ||||||||
| private const val EXPIRES_AT_KEY = "expiresAt" | ||||||||
| private const val SCOPE_KEY = "scope" | ||||||||
| private const val TOKEN_TYPE_KEY = "tokenType" | ||||||||
|
|
||||||||
| fun toMap(credentials: APICredentials): ReadableMap { | ||||||||
| val map = Arguments.createMap() | ||||||||
| map.putString(ACCESS_TOKEN_KEY, credentials.accessToken) | ||||||||
| map.putDouble(EXPIRES_AT_KEY, credentials.expiresAt.time / 1000.0) | ||||||||
| map.putString(SCOPE_KEY, credentials.scope) | ||||||||
| map.putString(TOKEN_TYPE_KEY, credentials.type) | ||||||||
| return map | ||||||||
| } | ||||||||
| } | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing newline at end of file The file should end with a newline character for POSIX compliance and consistency with the rest of the codebase.
Suggested change
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty headers map comment is misleading
The comment says "headers not supported from JS yet", but headers are not being passed because the React Native bridge doesn't expose this parameter. Consider either: