-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Yral Auth V2 follows standard OAuth 2.0 flows with minor extensions. Refer to oauth.com for comprehensive OAuth 2.0 documentation.
The principal of the user
JSON encoded signature from https://github.com/yral-dapp/yral-identity-ts/pkgs/npm/identity
An ICP compatible DelegatedIdentity, serialized to be transport-friendly
{
"from_key": [31, 32, 55, 33], // large list of bytes
"to_secret": {/*Json Web Key, usually secp256k1*/},
"delegation_chain": [{/*Signed Delegation*/}] // list of signed delegations
}
Typescript example of converting DelegatedIdentityWire
to an IC-compatible Delegated Identity:
https://github.com/yral-dapp/download-upload-service/blob/main/src/identity.ts#L51-L76
https://github.com/yral-dapp/download-upload-service/blob/main/src/identity.ts#L18-L29
Base: https://yral-auth-v2.fly.dev/
Token Endpoint: /oauth/token
Authorization Endpoint: /oauth/auth
RFC 8414 (Authorization Server Metadata) is not supported
Note: PKCE challenge with SHA256 is mandatory
Note: Only response_type=code
is supported
Note: Only response_mode=query
is supported
Supported Scopes: openid
Note: Client credentials are passed in request body
Note: Web Clients MUST pass client_secret
Note: Mobile/Native clients needn't pass client_secret
Note: Client credentials are passed in request body
Note: Web Clients MUST pass client_secret
Note: Mobile/Native clients needn't pass client_secret
This flow is used for generating anonymous identities. Each call will generate a distinct and separate identity
Note: Web Clients MUST pass client_secret
Note: Mobile/Native clients needn't pass client_secret
login_hint
parameter must be passed in the authorization code flow, if you want to connect an existing anonymous account(generated with client credentials flow) to a social account(e.g google).
login_hint
must be the following JSON object, URL encoded:
The following message must be signed with @yral-dapp/identity
const msg = new Messsage()
.withMethodName("yral_auth_v2_login_hint")
A JWK endpoint is not directly exposed, the following EdDSA PEM key can be used to verify JWT tokens returned from Toke Grant Flows:
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA04mJta0mU/O+rAVAjNzJxEWp+U8GKksjEI+vbepDfsQ=
-----END PUBLIC KEY----
The following claims are provided in the JWT Token from token grant flow:
{
"aud": "/*Client ID*/",
"exp": 11414321413, // Expiry in Epoch seconds, usually 7 days after "iat"
"iat": 11413332113, // Issued At time in Epoch Seconds
"iss": "/*Issuer host*/", // usually "yral-auth-v2.fly.dev"
"sub": "/* Principal Of the Identity*/",
"nonce": "xyz131231", // Optionally set if client set a nonce during authorization code flow
"ext_is_anonymous": false, // Whether this identity anonymous or not
"ext_delegated_identity": {/*DelegatedIdentityWire*/}
}
The returned delegated identity is valid for 7 days. The refresh token is valid for 30 days.