dotnet-client を使用して Google+ でアクティビティを作成しようとしています。問題は、クライアント アプリの構成を正しく取得できないように見えることです。Google+ サインインの構成とこの SO の質問に従って、requestvisibleactions パラメーターを追加する必要があります。私はそれをしましたが、うまくいきませんでした。私はスコープを使用しており、スコープhttps://www.googleapis.com/auth/plus.loginを追加しましたhttps://www.googleapis.com/auth/plus.moments.writeが、挿入はまだ機能しませんでした。
これは私のリクエストURLがどのように見えるかです:
https://accounts.google.com/ServiceLogin?service=lso&passive=1209600&continue=https://accounts.google.com/o/oauth2/auth?scope%3Dhttps://www.googleapis.com/auth/plus.login%2Bhttps://www.googleapis.com/auth/plus.moments.write%26response_type%3Dcode%26redirect_uri%3Dhttp://localhost/%26state%3D%26requestvisibleactions%3Dhttp://schemas.google.com/AddActivity%26client_id%3D000.apps.googleusercontent.com%26request_visible_actions%3Dhttp://schemas.google.com/AddActivity%26hl%3Den%26from_login%3D1%26as%3D-1fbe06f1c6120f4d<mpl=popup&shdf=Cm4LEhF0aGlyZFBhcnR5TG9nb1VybBoADAsSFXRoaXJkUGFydHlEaXNwbGF5TmFtZRoHQ2hpa3V0bwwLEgZkb21haW4aB0NoaWt1dG8MCxIVdGhpcmRQYXJ0eURpc3BsYXlUeXBlGgdERUZBVUxUDBIDbHNvIhTeWybcoJ9pXSeN2t-k8A4SUbfhsygBMhQivAmfNSs_LkjXXZ7bPxilXgjMsQ&scc=1
そこからわかるようrequest_visible_actionsに、パラメーターが間違っている場合に備えて、アンダースコアのないものも追加しました ( requestvisibleactions)。
私のアプリは API によって正常に認証されているとしましょう。認証後にユーザーのプロファイルを取得できますが、アプリが失敗するのは「挿入の瞬間」の部分です。私の挿入コード:
        var body = new Moment();
        var target = new ItemScope();
        target.Id = referenceId;
        target.Image = image;
        target.Type = "http://schemas.google.com/AddActivity";
        target.Description = description;
        target.Name = caption;
        body.Target = target;
        body.Type = "http://schemas.google.com/AddActivity";
        var insert =
            new MomentsResource.InsertRequest(
                // this is a valid service instance as I am using this to query the user's profile
                _plusService,
                body,
                id,
                MomentsResource.Collection.Vault);
        Moment result = null;
        try
        {
            result = insert.Fetch();
        }
        catch (ThreadAbortException)
        {
            // User was not yet authenticated and is being forwarded to the authorization page.
            throw;
        }
        catch (Google.GoogleApiRequestException requestEx)
        {                
            // here I get a 401 Unauthorized error
        }
        catch (Exception ex)
        {
        }            `