/// <summary> /// Builds an instance of LWAAccessTokenRequestMeta modeling appropriate LWA token /// request params based on configured LWAAuthorizationCredentials /// </summary> /// <param name="lwaAuthorizationCredentials">LWA Authorization Credentials</param> /// <returns></returns> public virtual LWAAccessTokenRequestMeta Build(LWAAuthorizationCredentials lwaAuthorizationCredentials) { LWAAccessTokenRequestMeta lwaAccessTokenRequestMeta = new LWAAccessTokenRequestMeta() { ClientId = lwaAuthorizationCredentials.ClientId, ClientSecret = lwaAuthorizationCredentials.ClientSecret, RefreshToken = lwaAuthorizationCredentials.RefreshToken }; if (lwaAuthorizationCredentials.Scopes == null || lwaAuthorizationCredentials.Scopes.Count == 0) { lwaAccessTokenRequestMeta.GrantType = SellerAPIGrantType; } else { lwaAccessTokenRequestMeta.Scope = string.Join(Delimiter, lwaAuthorizationCredentials.Scopes); lwaAccessTokenRequestMeta.GrantType = SellerlessAPIGrantType; } return(lwaAccessTokenRequestMeta); }
/// <summary> /// Constructor for LWAAuthorizationSigner /// </summary> /// <param name="lwaAuthorizationCredentials">LWA Authorization Credentials for token exchange</param> public LWAAuthorizationSigner(LWAAuthorizationCredentials lwaAuthorizationCredentials) { LWAClient = new LWAClient(lwaAuthorizationCredentials); }
public LWAClient(LWAAuthorizationCredentials lwaAuthorizationCredentials) { LWAAuthorizationCredentials = lwaAuthorizationCredentials; LWAAccessTokenRequestMetaBuilder = new LWAAccessTokenRequestMetaBuilder(); RestClient = new RestClient(LWAAuthorizationCredentials.Endpoint.GetLeftPart(System.UriPartial.Authority)); }