示例#1
0
 /// <summary>
 /// Creates an instance of <see cref="MetadataCredentials"/> that will use given access token to authenticate
 /// with a gRPC service.
 /// </summary>
 /// <param name="accessToken">OAuth2 access token.</param>
 /// /// <returns>The <c>MetadataCredentials</c> instance.</returns>
 public static MetadataCredentials FromAccessToken(string accessToken)
 {
     return(new MetadataCredentials(AuthInterceptors.FromAccessToken(accessToken)));
 }
示例#2
0
 /// <summary>
 /// Creates a <see cref="MetadataCredentials"/> instance that will obtain access tokens
 /// from any credential that implements <c>ITokenAccess</c>. (e.g. <c>GoogleCredential</c>).
 /// </summary>
 /// <param name="credential">The credential to use to obtain access tokens.</param>
 /// <returns>The <c>MetadataCredentials</c> instance.</returns>
 public static MetadataCredentials Create(ITokenAccess credential)
 {
     return(new MetadataCredentials(AuthInterceptors.FromCredential(credential)));
 }